<template>
  <common-echarts :option="option" ref="echarts" :height="600"></common-echarts>
</template>

<script>
import CommonEcharts from "./echarts.vue";

export default {
  name: "GuageEcharts",
  components: {
    CommonEcharts,
  },
  computed: {
    option() {
      let series = [
        {
          name: "指针",
          type: "gauge",
          detail: { formatter: "{value}%" },
          data: [{ value: 80, name: "速度" }],
        },
      ];

      return {
        title: {
          text: "仪表盘",
          subtext: "仪表盘速度",
          left: "center",
        },
        tooltip: {
          trigger: "item",
          formatter: "{a} <br />{b}: {c}%",
        },
        series: series,
      };
    },
  },
  data() {
    return {};
  },
  methods: {
    refresh() {
      console.log("option:", this.option);
      this.$nextTick(this.$refs.echarts.refresh);
    },
  },
};
</script>
